
// import oimo.common.Vec3;

import { Vec3 } from "../../../../common/Vec3";
import { EpaTriangle } from "./EpaTriangle";

/**
 * numberernal class.
 */


export class EpaVertex {
	_next: EpaVertex; // for object pooling

	v: Vec3;
	w1: Vec3;
	w2: Vec3;

	_tmpEdgeLoopNext: EpaVertex;
	_tmpEdgeLoopOuterTriangle: EpaTriangle;

	randId: number = Math.ceil(Math.random() * 100000);

	constructor() {
		this.v = new Vec3();
		this.w1 = new Vec3();
		this.w2 = new Vec3();
	}

	public init(v: Vec3, w1: Vec3, w2: Vec3): EpaVertex {
		this.v.copyFrom(v);
		this.w1.copyFrom(w1);
		this.w2.copyFrom(w2);
		this._next = null;
		this._tmpEdgeLoopNext = null;
		this._tmpEdgeLoopOuterTriangle = null;
		return this;
	}

	public removeReferences(): void {
		this._next = null;
		this._tmpEdgeLoopNext = null;
		this._tmpEdgeLoopOuterTriangle = null;
	}

}
